#include "ros/ros.h"
#include "my_pkg/my_msg.h"
#include <sstream>
#include <iostream>
using namespace std;

int main(int argc, char ** argv)
{
    ros::init(argc, argv, "talker");
    ros::NodeHandle n;
    ros::Publisher chatter_pub = n.advertise<my_pkg::my_msg>("chatter", 1000);
    ros::Rate loop_rate(10);
    int count = 0;
    while (ros::ok())
    {
        my_pkg::my_msg msg;
        std::stringstream ss;
        msg.data = count * 0.1;
        ss << "I send: hello world " << count;
        msg.s = ss.str();
        ROS_INFO("%s", msg.s.c_str());
        cout<<msg.data<<endl;
        // ROS_INFO("%s", msg.data.c_str());
        chatter_pub.publish(msg);
        ros::spinOnce();
        loop_rate.sleep();
        ++count;
    }
    return 0;
}
